from django.db import models

# Create your models here.
class BaseMode(models.Model):
    create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
    update_time = models.DateTimeField(auto_now=True, verbose_name='更新时间')

    class Meta:
        abstract = True  # 它是一个抽象类，默认允许下面类继承


# 用户模块（用户表，区域表，用户地址表）
# 用户表
# class Users(BaseMode):
#     username = models.CharField(max_length=50)
#     password = models.CharField(max_length=400)
#     phone = models.CharField(max_length=11)
#     class Meta:
#         db_table = 'users'
# # 区域表
# class Area(BaseMode):
#     name = models.CharField(max_length=100)
#     pid = models.ForeignKey('self',on_delete=models.SET_NULL,null=True,blank=True)
#     class Meta:
#         db_table='area'
#
#
# class Uaddress(BaseMode):
#     users = models.ForeignKey(Users,models.CASCADE)
#     area = models.ForeignKey(Area,models.CASCADE)

class Journalism(BaseMode):
    headline = models.CharField(max_length=50)
    contemt = models.TextField(default='')
    class Meta:
        db_table='journalism'



class Advertising(BaseMode):
    pic = models.ImageField(default='',verbose_name='图片')
    urls = models.CharField(max_length=50,verbose_name='标题')
    type = models.IntegerField(verbose_name='类型')  # 1.轮播图  2.右边小图

    class Meta:
        db_table = 'advertising'
